package www.wxwnb.clerk.ui.api;

import io.reactivex.Flowable;
import okhttp3.MultipartBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import www.wxwnb.clerk.bean.AlreadyCheckBean;
import www.wxwnb.clerk.bean.LogBean;
import www.wxwnb.clerk.bean.QueryBean;
import www.wxwnb.clerk.utils.UrlConnect;

/**
 * Created by lenovo on 2017/9/11.
 * 接口
 */

public interface ApiServer {
    /**
     * 登陆
     */
    @POST(UrlConnect.LOG)
    @FormUrlEncoded
    Flowable<LogBean> sendLog(@Field("loginName") String loginName, @Field("password") String password);

    /**
     * 业务开户
     * loginName登陆名
     * password密码
     * userName用户名
     * type商家类型
     * phone电话
     * address地址
     * monery余额
     * licenseImage营业执照
     * otherImage其他图片
     * parentChief上级商家的id
     * jobNumber业务员工号
     * accountImage转账记录
     */
    @Headers("Content-type:application/x-www-form-urlencoded;charset=utf-8")
    @POST(UrlConnect.OPEN_ACCOUNT)
    @FormUrlEncoded
    Flowable<LogBean> openAccount(@Field("loginName") String loginName, @Field("password") String password,
                                  @Field("userName") String userName, @Field("type") int type, @Field("phone") String phone,
                                  @Field("address") String address, @Field("monery") double monery, @Field("licenseImage") String licenseImage,
                                  @Field("otherImage") String otherImage, @Field("parentChief") int parentChief, @Field("jobNumber")
                                          String jobNumber, @Field("accountImage") String accountImage
    );


    @Multipart
    @POST(UrlConnect.UPLOAD_IMG)
    Flowable<LogBean> uploadImage(@Part MultipartBody.Part file);

    @POST(UrlConnect.ALREADY_CHECKED)
    @FormUrlEncoded
    Flowable<AlreadyCheckBean> alreadyChecked(@Field("jobNumber") String jobNumber , @Field("pageNum") int PageNum);


    @POST(UrlConnect.UNCHECKED)
    @FormUrlEncoded
    Flowable<AlreadyCheckBean> unChecked(@Field("jobNumber") String jobNumber , @Field("pageNum") int PageNum);

    @POST(UrlConnect.FAILPASS)
    @FormUrlEncoded
    Flowable<AlreadyCheckBean> failPass(@Field("jobNumber") String jobNumber , @Field("pageNum") int PageNum);

    @GET(UrlConnect.QUERY_BUS)
    Flowable<QueryBean> queryBusiness();
}
